//小设备导航
var menuLeft = document.getElementById( 'cbp-spmenu' ),
            showLeft = document.getElementById( 'showLeft' ),
            body = document.body;

            showLeft.onclick = function() {
            classie.toggle( this, 'active' );
            classie.toggle( menuLeft, 'cbp-spmenu-open' );
            disableOther( 'showLeft' );
        };

        function disableOther( button ) {
            if( button !== 'showLeft' ) {
                classie.toggle( showLeft, 'disabled' );
            }
        }

var menuItem = document.getElementById( 'cbp-spmenu' );
menuItem.onclick = function() {
    classie.toggle( this, 'active' );
    classie.toggle( menuLeft, 'cbp-spmenu-open' );
    disableOther( 'showLeft' );
};

$(function() {
	$.fn.toTop = function(options) {
		var defaults = {			
			showHeight : 150,
			speed : 1000
		};
		var options = $.extend(defaults,options);
		$("body").prepend("<div id='totop'><a></a></div>");
		var $toTop = $(this);
		var $top = $("#totop");
		var $ta = $("#totop a");
		$toTop.scroll(function(){
			var scrolltop=$(this).scrollTop();		
			if(scrolltop>=options.showHeight){				
				$top.show();
			}
			else{
				$top.hide();
			}
		});	
		$ta.hover(function(){ 		
			$(this).addClass("cur");	
		},function(){			
			$(this).removeClass("cur");		
		});	
		$top.click(function(){
			$("html,body").animate({scrollTop: 0}, options.speed);	
		});
	}
});



 $(document).ready(function() {
	    var d = new Date();
		var vMon = d.getMonth()-1;
		var vDay = d.getDate()-3;
	 	var adutime = String((new Date()).valueOf());
	 	var value=adutime.substring(3,adutime.length-5) ;
	 	value = vMon + "" + vDay + "" + value;
	 	$('#nowhelpuser').text(value);
	 
        $('#sections, #sections_mobile').onePageNav({
            currentClass: 'current',
            changeHash: false,
            scrollSpeed: 1000,
            scrollOffset: 77,
            scrollThreshold: 0.2,
            easing: 'easeInOutExpo'
        });
     
        $('#logo a').click(function () {
            $('body,html').animate({
                scrollTop: 0
            }, 800);
            return false;
        }); 
         
         $('#btn-index-arrow, #case-test').click(function () {
            $.scrollTo('#testing',800,{easing:'easeInOutExpo',offset:-77,'axis':'y'});
        }); 

         
         setTimeout(function (){ $('.btn-index').addClass('anim'); }, 1000); 
         //淡入
         $('#description').waypoint(function(direction) {
        	 $('#description').animate({ opacity: 1 }, 1500);
        	 setTimeout(function (){ $('#testing').animate({ opacity: 1 }, 1500); }, 500); 
        	 setTimeout(function (){ $('#ques').animate({ opacity: 1 }, 1500); }, 1000);
           }, { offset: 400}); 

     //横幅效果
        $('.tlt').textillate({
                selector: '.texts',
                loop: true,
                initialDelay: 10,
                'inner': {
                    effect: 'fadeInDown',
                    delayScale: 1.3,
                    delay: 40,
                    sync: false,
                    shuffle: true
                },
                'out': {
                    effect: 'fadeOutDown',
                    delayScale: 1.3,
                    delay: 40,
                    sync: false,
                    shuffle: true
                }                              
        });    
        $('#home p').textillate({
                loop: false,
                'inner': {
                    effect: 'fadeInUp',
                    delayScale: 0.5,
                    delay: 10,
                    sync: false,
                    shuffle: true
                }
        });
        
        $(window).toTop({
            showHeight: 100,
            speed: 400
        });

    });